// 2025/07/27
// Author: Forever
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 500001;
int n, m, a[MAXN], c[MAXN], ans[MAXN], last_pos[MAXN];
#define lowbit(x) (x & -x)

inline void add(int x, int v)
{
    while (x <= n)
        c[x] += v, x += lowbit(x);
}

inline int sum(int x, int y)
{
    x--;
    int res1 = 0, res2 = 0;
    while (x)
        res1 += c[x], x -= lowbit(x);
    while (y)
        res2 += c[y], y -= lowbit(y);
    return res2 - res1;
}

inline void init()
{
    for (int i = 1; i <= n; ++i) {
        c[i] += a[i];
        int j = i + lowbit(i);
        if (j <= n)
            c[j] += c[i];
    }
}

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    init();
    for (int i = 1; i <= m; i++) {
        int op, x, y;
        cin >> op >> x >> y;
        if (op == 1)
            add(x, y);
        else
            cout << sum(x, y) << "\n";
    }
    return 0;
}